<%@ page contentType="text/html; charset=iso-8859-1" %>
<%@ page import="ro.gateway.aida.servlet.*" %>
<%@ page import="ro.gateway.aida.obj.Person" %>
<%@ page import="ro.gateway.aida.obj.db.PersonDB" %>
<%@ page import="ro.gateway.aida.srv.ICFService" %>
<%@ page import="ro.gateway.aida.servlet.Constants" %>
<%@ page import="java.util.Hashtable" %>
<%@ page import="ro.gateway.aida.srv.EditorServlet" %>
<%@ page import = "java.util.Hashtable,
				   ro.gateway.aida.utils.HttpUtils,
                   ro.xblue.translator.LanguageBean,
                   ro.xblue.translator.TranslatorConstants,
                   ro.xblue.translator.TranslatorUtils,
                   ro.gateway.aida.db.PersistenceManager,
                   ro.gateway.aida.db.PersistenceToken" %>
<%@ taglib uri="/WEB-INF/taglib.tld" prefix="gtw" %>
<%@ taglib uri="/WEB-INF/translator.tld" prefix="trans" %>
<%@ taglib uri="/WEB-INF/usr.tld" prefix="usr" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<html>
<head>

<title>Local Projects Database - Person Editor</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="alf.css" type="text/css">
<STYLE>.text_searchbold {
	FONT-WEIGHT: bold; FONT-SIZE: 8pt; COLOR: #000000; FONT-STYLE: normal; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
; text-decoration: none}
.text_search {
	FONT-SIZE: 8pt; FONT-STYLE: normal; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: none
}
.text {
	FONT-WEIGHT: normal; FONT-SIZE: 9pt; FONT-STYLE: normal; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: none
}
.titlu {
	FONT-WEIGHT: bold; FONT-SIZE: 11pt; FONT-STYLE: normal; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: none
}
A:hover {
	TEXT-DECORATION: underline
}
</STYLE>
<link rel="stylesheet" href="../alf.css" type="text/css">
 <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"> 
</head>


<%
 //init translator

LanguageBean lang_bean = TranslatorUtils.getCurrentLanguage(request, application);

PersonDB persdb =PersonDB.getManager(PersistenceManager.tokenLookup(application));
          


 Hashtable bean = (Hashtable) request.getAttribute(EditPersonServlet.PNAME_BEAN);
    if (bean == null) {
        response.sendError(HttpServletResponse.SC_NOT_FOUND);
        return;
    }

    String key = (String) bean.get(EditPersonServlet.PNAME_KEY);
    String ctx = request.getContextPath();

Person pers = (Person) bean.get(EditPersonServlet.PNAME_PERS);
String editing_action = (String) bean.get(EditPersonServlet.PNAME_ACTION);

Object screen = request.getAttribute(EditPersonServlet.PNAME_SCREEN);
    String[] errors = (String[]) request.getAttribute(EditPersonServlet.PNAME_ERRORS);


/*if (request.getParameter("lang")!=null) {
  lang=request.getParameter("lang");
 }*/
//LNGTrans t=new LNGTrans("PersOp",lang,application);

%>

<trans:initPage module="persform" />
<body bgcolor="#FFFFFF" text="#000000" topmargin=0 leftmargin=0>

<% String lang=lang_bean.language; %>

<jsp:include page="../header.jsp" />
<% if (EditPersonServlet.PV_SCR_EDIT.equals(screen)) { %>



<form name="theform" method="post" action="<%=ctx%>/pers/edit">
<input type="hidden" name="<%=EditorServlet.PNAME_KEY%>" value="<%=key%>" />
<input type="hidden" name="lang" value="<%=lang%>" />
<input type="hidden" name="<%=EditorServlet.PNAME_ACTION%>" value="<%=EditorServlet.PV_ACTION_EDIT%>" />
<% if (errors != null) { %>
    <tr>
        <td colspan="2">
        <trans:showPageMessage label="pers.errors" />
        <% for (int i = 0; i < errors.length; i++) { %>
        <%=errors[i]%>
        <% } %>
    </tr></td>
  <% } %>
  <table width="90%" border="0" cellspacing="1" cellpadding="4" background=<%=ctx%>/images/pixelbgtable.gif align="center">
    <tr>
      <td colspan="2" class="textalb" background=<%=ctx%>/images/pixelbgtable.gif>
        <div align="center"><trans:showPageMessage label="pers.info" /></div>
      </td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td width="30%" class="text_searchBold"><trans:showPageMessage label="pers.name" />:
      </td>
      <td width="70%" class="text_search" valign="top">
        <input type="text" name="firstnames" value="<%=pers.getFirstNames()%>" size="50" maxlength="100" style="BACKGROUND-COLOR: #ffffff; BORDER-BOTTOM: #cacaca 1px solid; BORDER-LEFT: #cacaca 1px solid; BORDER-RIGHT: #cacaca 1px solid; BORDER-TOP: #cacaca 1px solid; FONT: 11px Verdana, Arial, san-serif">

      </td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td width="30%" class="text_searchBold"><trans:showPageMessage label="pers.lname" />:
      </td>
      <td width="70%" class="text_search" valign="top">
        <input type="text" name="lastname" value="<%=pers.getLastName()%>" size="50" maxlength="100" style="BACKGROUND-COLOR: #ffffff; BORDER-BOTTOM: #cacaca 1px solid; BORDER-LEFT: #cacaca 1px solid; BORDER-RIGHT: #cacaca 1px solid; BORDER-TOP: #cacaca 1px solid; FONT: 11px Verdana, Arial, san-serif" >
		
      </td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td width="30%" class="text_searchBold"><trans:showPageMessage label="pers.domain" />:</td>
      <td width="70%" class="text_search" valign="top">
        <textarea name="department" wrap="VIRTUAL" cols="50" rows="4" onkeydown="textCounter(this.form.department,this.form.cdepartment,3000);" onkeyup="textCounter(this.form.department,this.form.cdepartment,3000);"><%=pers.getDepartment()%></textarea>
		<input readonly type="text" name="cdepartment" size="3" maxlength="4" value=""> <trans:showPageMessage label="charactersleft" />
      </td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td width="30%" class="text_searchBold"><trans:showPageMessage label="pers.country" />:</td>
      <td width="70%" class="text_search" valign="top">
        <select name="countryISO3">
          <option><trans:showPageMessage label="pers.cpick" /></option>
          <%=persdb.createCountryList(pers)%>
        </select>
      </td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td width="30%" class="text_searchBold"><trans:showPageMessage label="pers.state" />:</td>
      <td width="70%" class="text_search" valign="top">
        <input type="text" name="state" value="<%=HttpUtils.strPrint(pers.getState(),"")%>" size="20" maxlength="256" style="BACKGROUND-COLOR: #ffffff; BORDER-BOTTOM: #cacaca 1px solid; BORDER-LEFT: #cacaca 1px solid; BORDER-RIGHT: #cacaca 1px solid; BORDER-TOP: #cacaca 1px solid; FONT: 11px Verdana, Arial, san-serif">
		
      </td>
      
    </tr>
    <tr bgcolor="#FFFFFF">
      <td width="30%" class="text_searchBold"><trans:showPageMessage label="pers.address" />:</td>
      <td width="70%" class="text_search" valign="top">
        <textarea name="address"  cols="40" rows="3" wrap="VIRTUAL" onkeydown="textCounter(this.form.address,this.form.caddress,1000);" onkeyup="textCounter(this.form.address,this.form.caddress,1000);"><%=HttpUtils.strPrint(pers.getAddress(),"")%></textarea>
		<input readonly type="text" name="caddress" size="3" maxlength="4" value=""> <trans:showPageMessage label="charactersleft" />
      </td>
    </tr>
    <!--
    <tr bgcolor="#FFFFFF">
      <td width="30%" class="text_searchBold"><trans:showPageMessage label="pers.cpost" />:</td>
      <td width="70%" class="text_search" valign="top">
        <input type="text" name="postalcode" value="<%=HttpUtils.strPrint(pers.getPostalCode(),"")%>" size="12" maxlength="100" style="BACKGROUND-COLOR: #ffffff; BORDER-BOTTOM: #cacaca 1px solid; BORDER-LEFT: #cacaca 1px solid; BORDER-RIGHT: #cacaca 1px solid; BORDER-TOP: #cacaca 1px solid; FONT: 11px Verdana, Arial, san-serif"/> 
	  </td>
    </tr>
    -->
    <tr bgcolor="#FFFFFF">
      <td width="30%" class="text_searchBold"><trans:showPageMessage label="pers.phone" />:</td>
      <td width="70%" class="text_search" valign="top">
       <input type="text" name="phone1" value="<%=HttpUtils.strPrint(pers.getPhone(1),"")%>" size="5" maxlength="30" style="BACKGROUND-COLOR: #ffffff; BORDER-BOTTOM: #cacaca 1px solid; BORDER-LEFT: #cacaca 1px solid; BORDER-RIGHT: #cacaca 1px solid; BORDER-TOP: #cacaca 1px solid; FONT: 11px Verdana, Arial, san-serif" />&nbsp;-
      <input type="text" name="phone2" value="<%=HttpUtils.strPrint(pers.getPhone(2),"")%>" size="5" maxlength="30" style="BACKGROUND-COLOR: #ffffff; BORDER-BOTTOM: #cacaca 1px solid; BORDER-LEFT: #cacaca 1px solid; BORDER-RIGHT: #cacaca 1px solid; BORDER-TOP: #cacaca 1px solid; FONT: 11px Verdana, Arial, san-serif" />&nbsp;-
      <input type="text" name="phone3" value="<%=HttpUtils.strPrint(pers.getPhone(3),"")%>" size="15" maxlength="30" style="BACKGROUND-COLOR: #ffffff; BORDER-BOTTOM: #cacaca 1px solid; BORDER-LEFT: #cacaca 1px solid; BORDER-RIGHT: #cacaca 1px solid; BORDER-TOP: #cacaca 1px solid; FONT: 11px Verdana, Arial, san-serif"/>
		

      </td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td width="30%" class="text_searchBold"><trans:showPageMessage label="pers.fax" />:</td>
      <td width="70%" class="text_search" valign="top">
	    <input type="text" name="fax1" value="<%=HttpUtils.strPrint(pers.getFax(1),"")%>" size="5" maxlength="30" style="BACKGROUND-COLOR: #ffffff; BORDER-BOTTOM: #cacaca 1px solid; BORDER-LEFT: #cacaca 1px solid; BORDER-RIGHT: #cacaca 1px solid; BORDER-TOP: #cacaca 1px solid; FONT: 11px Verdana, Arial, san-serif" />&nbsp;-
		<input type="text" name="fax2" value="<%=HttpUtils.strPrint(pers.getFax(2),"")%>" size="5" maxlength="30" style="BACKGROUND-COLOR: #ffffff; BORDER-BOTTOM: #cacaca 1px solid; BORDER-LEFT: #cacaca 1px solid; BORDER-RIGHT: #cacaca 1px solid; BORDER-TOP: #cacaca 1px solid; FONT: 11px Verdana, Arial, san-serif" />&nbsp;-
	    <input type="text" name="fax3" value="<%=HttpUtils.strPrint(pers.getFax(3),"")%>" size="15" maxlength="30" style="BACKGROUND-COLOR: #ffffff; BORDER-BOTTOM: #cacaca 1px solid; BORDER-LEFT: #cacaca 1px solid; BORDER-RIGHT: #cacaca 1px solid; BORDER-TOP: #cacaca 1px solid; FONT: 11px Verdana, Arial, san-serif" />
	      </td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td width="30%" class="text_searchBold"><trans:showPageMessage label="pers.email" />:</td>
      <td width="70%" class="text_search" valign="top">
        <input type="text" name="email" value="<%=HttpUtils.strPrint(pers.getEmail(),"")%>" size="30" maxlength="100" style="BACKGROUND-COLOR: #ffffff; BORDER-BOTTOM: #cacaca 1px solid; BORDER-LEFT: #cacaca 1px solid; BORDER-RIGHT: #cacaca 1px solid; BORDER-TOP: #cacaca 1px solid; FONT: 11px Verdana, Arial, san-serif">		
      </td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td width="30%" class="text_searchBold"><trans:showPageMessage label="pers.url" />:</td>
      <td width="70%" class="text_search" valign="top">http://
        <input type="text" name="URL" value="<%=HttpUtils.strPrint(pers.getURL(),"")%>" size="30" maxlength="200" style="BACKGROUND-COLOR: #ffffff; BORDER-BOTTOM: #cacaca 1px solid; BORDER-LEFT: #cacaca 1px solid; BORDER-RIGHT: #cacaca 1px solid; BORDER-TOP: #cacaca 1px solid; FONT: 11px Verdana, Arial, san-serif"/>
		
      </td>
    </tr>
    <tr>
      <td bgcolor="f9f9f9" colspan=2 align=center>
        <input name="sbutton" type="button" class="butonsave" value="<trans:showPageMessage label="pers.save" hide_link="true" />" onclick="javascript:submit_theform('<%=EditorServlet.PV_ACTION_CONFIRM%>');">
        <input name="cbutton" type="button" class="butonsave" value="<trans:showPageMessage label="pers.cancel" hide_link="true" />" onClick="javascript:submit_thecancel('<%=EditorServlet.PV_ACTION_CANCEL%>');">
<% if (EditorServlet.PV_ACTION_EDIT.equals(editing_action)) { %>
      <input name="dbutton" type="button" value="<trans:showPageMessage label="pers.delete" hide_link="true" />" onClick="javascript:submit_thecancel('<%=EditorServlet.PV_ACTION_DELETE%>');" class="butonsave">
<% } %></td>
    </tr>
  </table>
</form>

<script language="javascript">

function disable() {
       document.theform.sbutton.disabled=1;
       document.theform.cbutton.disabled=1;

<% if (EditorServlet.PV_ACTION_EDIT.equals(editing_action)) { %>
document.theform.dbutton.disabled=1;
<% } %>
}

    function submit_theform(action) {
if (formCheck()==false) return false;
disable();
document.theform.action.value=action;
document.theform.submit();
    }
    function submit_thecancel(action) {
disable();
document.theform.action.value=action;
document.theform.submit();
    }

</script>


<!-- Confirm the form -->
<% } else if (EditPersonServlet.PV_SCR_CONFIRM.equals(screen)) { %>
<form name="theform" method="post" action="<%=ctx%>/pers/edit" onSubmit="return formCheck()">
<input type="hidden" name="<%=EditorServlet.PNAME_KEY%>" value="<%=key%>" />
<input type="hidden" name="<%=EditorServlet.PNAME_ACTION%>" value="<%=EditorServlet.PV_ACTION_EDIT%>" />
  <table width="90%" border="0" cellspacing="1" cellpadding="4" background=<%=ctx%>/images/pixelbgtable.gif align="center">
    <tr bgcolor="#FFFFFF">
      <td colspan="2" class="textalb" background=<%=ctx%>/images/pixelbgtable.gif>
        <div align="center"><trans:showPageMessage label="pers.info" /></div>
      </td>
    </tr>
    <tr bgcolor="f9f9f9">
      <td width="30%" class="text_searchBold"><trans:showPageMessage label="pers.name" />:
      </td>
      <td width="70%" class="text_search" valign="top"> <%=pers.getFirstNames()%>
      </td>
    </tr>
    <tr bgcolor="f9f9f9">
      <td width="30%" class="text_searchBold"><trans:showPageMessage label="pers.lname" />:
      </td>
      <td width="70%" class="text_search" valign="top"> <%=pers.getLastName()%>
      </td>
    </tr>
    <tr bgcolor="f9f9f9">
      <td width="30%" class="text_searchBold"><trans:showPageMessage label="pers.domain" />:</td>
      <td width="70%" class="text_search" valign="top"> <%=pers.getDepartment()%>
      </td>
    </tr>
    <tr bgcolor="f9f9f9">
      <td width="30%" class="text_searchBold"><trans:showPageMessage label="pers.country" />:</td>
      <td width="70%" class="text_search" valign="top"> <%=persdb.getCountryName(pers)%>
      </td>
    </tr>
    <tr bgcolor="f9f9f9">
      <td width="30%" class="text_searchBold"><trans:showPageMessage label="pers.state" />:</td>
      <td width="70%" class="text_search" valign="top"> <%=HttpUtils.strPrint(pers.getState(),"--")%> </td>
    </tr>
    <tr bgcolor="f9f9f9">
      <td width="30%" class="text_searchBold"><trans:showPageMessage label="pers.address" />:</td>
      <td width="70%" class="text_search" valign="top"> <%=HttpUtils.strPrint(pers.getAddress(),"--")%>
      </td>
    </tr>
    <tr bgcolor="f9f9f9">
      <td width="30%" class="text_searchBold"><trans:showPageMessage label="pers.cpost" />:</td>
      <td width="70%" class="text_search" valign="top"> <%=HttpUtils.strPrint(pers.getPostalCode(),"--")%>
      </td>
    </tr>
    <tr bgcolor="f9f9f9">
      <td width="30%" class="text_searchBold"><trans:showPageMessage label="pers.phone" />:</td>
      <td width="70%" class="text_search" valign="top"> <%=HttpUtils.strPrint(pers.getPhone(),"--")%> </td>
    </tr>
    <tr bgcolor="f9f9f9">
      <td width="30%" class="text_searchBold"><trans:showPageMessage label="pers.fax" />:</td>
      <td width="70%" class="text_search" valign="top"> <%=HttpUtils.strPrint(pers.getFax(),"--")%> </td>
    </tr>
    <tr bgcolor="f9f9f9">
      <td width="30%" class="text_searchBold"><trans:showPageMessage label="pers.email" />:</td>
      <td width="70%" class="text_search" valign="top"> <%=HttpUtils.strPrint(pers.getEmail(),"--")%> </td>
    </tr>
    <tr bgcolor="f9f9f9">
      <td width="30%" class="text_searchBold"><trans:showPageMessage label="pers.url" />:</td>
      <td width="70%" class="text_search" valign="top">http:// <%=HttpUtils.strPrint(pers.getURL(),"--")%>
      </td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td align=center colspan=2>
        <input name="sbutton" type="button" value="<trans:showPageMessage label="pers.confirm" hide_link="true" />" onclick="javascript:submit_theform('<%=EditorServlet.PV_ACTION_SAVE%>');" class="butonsave">&nbsp;
        <% if (!EditPersonServlet.PV_ACTION_DELETE.equals(editing_action)) { %>
        <input name="bbutton" type="button" value="<trans:showPageMessage label="pers.back" hide_link="true" />" onclick="javascript:submit_theform('<%=EditorServlet.PV_ACTION_EDIT%>');" class="butonsave">
        <% } %>
        &nbsp;
        <input name="cbutton" type="button" value="<trans:showPageMessage label="pers.cancel" hide_link="true" />" onClick="javascript:submit_theform('<%=EditorServlet.PV_ACTION_CANCEL%>');" class="butonsave">
      </td>
    </tr>
  </table>
</form>
<script language="javascript">
    function submit_theform(action) {
        document.theform.sbutton.disabled=1;
        document.theform.cbutton.disabled=1;
        if (document.theform.bbutton) {
        document.theform.bbutton.disabled=1;
        }
        document.theform.action.value=action;
         document.theform.submit();
    }
</script>

<% } %>



<script language="javascript">
function trim(inputString) {
   // Removes leading and trailing spaces from the passed string. Also removes
   // consecutive spaces and replaces it with one space. If something besides
   // a string is passed in (null, custom object, etc.) then return the input.
   if (typeof inputString != "string") { return inputString; }
   var retValue = inputString;
   var ch = retValue.substring(0, 1);
   while (ch == " ") { // Check for spaces at the beginning of the string
      retValue = retValue.substring(1, retValue.length);
      ch = retValue.substring(0, 1);
   }
   ch = retValue.substring(retValue.length-1, retValue.length);
   while (ch == " ") { // Check for spaces at the end of the string
      retValue = retValue.substring(0, retValue.length-1);
      ch = retValue.substring(retValue.length-1, retValue.length);
   }
   while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
      retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
   }
   return retValue; // Return the trimmed string back to the user
} // Ends the "trim" function



function noBlank(strItem, strMessage)
{
var strValue
strValue=eval("document.theform." + strItem + ".value");
strValue=trim(strValue);
if(strValue=="")
    {
    alert("The " + strMessage + " field cannot be blank!");
    return false;
    }
return true;
}

function tooLong(strItem, len, strMessage)
{
var lenValue
lenValue=eval("document.theform." + strItem + ".value.length");
if(lenValue>len)
    {
    alert("The " + strMessage + " field is too long!");
    return false;
    }
return true;
}



function emailCheck (emailStr) {
	if(emailStr=="") return true;
/* The following pattern is used to check if the entered e-mail address
   fits the user@domain format.  It also is used to separate the username
   from the domain. */
var emailPat=/^(.+)@(.+)$/
/* The following string represents the pattern for matching all special
   characters.  We don't want to allow special characters in the address.
   These characters include ( ) < > @ , ; : \ " . [ ]    */
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
/* The following string represents the range of characters allowed in a
   username or domainname.  It really states which chars aren't allowed. */
var validChars="\[^\\s" + specialChars + "\]"
/* The following pattern applies if the "user" is a quoted string (in
   which case, there are no rules about which characters are allowed
   and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
   is a legal e-mail address. */
var quotedUser="(\"[^\"]*\")"
/* The following pattern applies for domains that are IP addresses,
   rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
   e-mail address. NOTE: The square brackets are required. */
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
/* The following string represents an atom (basically a series of
   non-special characters.) */
var atom=validChars + '+'
/* The following string represents one word in the typical username.
   For example, in john.doe@somewhere.com, john and doe are words.
   Basically, a word is either an atom or quoted string. */
var word="(" + atom + "|" + quotedUser + ")"
// The following pattern describes the structure of the user
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
/* The following pattern describes the structure of a normal symbolic
   domain, as opposed to ipDomainPat, shown above. */
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")


/* Finally, let's start trying to figure out if the supplied address is
   valid. */

/* Begin with the coarse pattern to simply break up user@domain into
   different pieces that are easy to analyze. */
var matchArray=emailStr.match(emailPat)
if (matchArray==null) {
  /* Too many/few @'s or something; basically, this address doesn't
     even fit the general mould of a valid e-mail address. */
	alert("Email address seems incorrect (check @ and .'s)")
	return false
}
var user=matchArray[1]
var domain=matchArray[2]

// See if "user" is valid
if (user.match(userPat)==null) {
    // user is not valid
    alert("Email:The username doesn't seem to be valid.")
    return false
}

/* if the e-mail address is at an IP address (as opposed to a symbolic
   host name) make sure the IP address is valid. */
var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
    // this is an IP address
	  for (var i=1;i<=4;i++) {
	    if (IPArray[i]>255) {
	        alert("Email:Destination IP address is invalid!")
		return false
	    }
    }
    return true
}

// Domain is symbolic name
var domainArray=domain.match(domainPat)
if (domainArray==null) {
	alert("Email:The domain name doesn't seem to be valid.")
    return false
}

/* domain name seems valid, but now make sure that it ends in a
   three-letter word (like com, edu, gov) or a two-letter word,
   representing country (uk, nl), and that there's a hostname preceding
   the domain or country. */

/* Now we need to break up the domain to get a count of how many atoms
   it consists of. */
var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 ||
    domArr[domArr.length-1].length>3) {
   // the address must end in a two letter or three letter word.
   alert("Email:The address must end in a three-letter domain, or two letter country.")
   return false
}

// Make sure there's a host name preceding the domain.
if (len<2) {
   var errStr="Email:This address is missing a hostname!"
   alert(errStr)
   return false
}

// If we've gotten this far, everything's valid!
return true;
}



function formCheck()
{
var ret=true;
	ret&=noBlank("firstnames","First Names");
	ret&=noBlank("lastname","Last Name");
	ret&=noBlank("department","Department");
	ret&=noBlank("countryISO3","Country");

	ret&=emailCheck(trim(document.theform.email.value));
return ret;
}


function chlang(dd) {
if(dd.options[dd.selectedIndex].value == 'ro') window.location='<%=ctx%>/pers/edit?lang=ro';
if(dd.options[dd.selectedIndex].value == 'us') window.location='<%=ctx%>/pers/edit?lang=us';
}

</script>
<script type="text/javascript" src="<html:rewrite page='/javascript/textCounter.js'/>" ></script>
<trans:showPageMessage label="translator.showhiddentags"/>
<jsp:include page="../footer.jsp" />

</body>
 <HEAD> 
 <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"> 
 </HEAD> 
</html>

